package com.pubinfo.passbook.twiteoff;

import com.pubinfo.passbook.common.entity.TPassbook;
import com.pubinfo.passbook.common.mapper.TSourcePassbookMapper;
import com.pubinfo.passbook.common.service.master.TPassbookService;
import com.pubinfo.passbook.common.service.master.TWiteoffInstanceService;
import com.pubinfo.passbook.common.utils.UccpUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
public class queryTWiteoffInstance {
  
  @Autowired
  TWiteoffInstanceService instanceService;
  
  @Autowired
  TSourcePassbookMapper passbookMapper;
  @Autowired
  TPassbookService passbookService;
//
//  @Test
//  public void queryTwiteoff() {
//    QueryWiteoffInstanceParam instanceParam = new QueryWiteoffInstanceParam();
//    instanceParam.setAccount("luocb");
//    instanceParam.setEconomicItemName("经济事项名称");
//    instanceParam.setSapCompayCode("G3309");
//    instanceParam.setWiteoffInstanceCode("20210720");
//    instanceParam.setStatus(2);
//    Calendar instance = Calendar.getInstance();
//    instance.setTime(new Date());
//    instance.add(Calendar.DAY_OF_MONTH, -1);
//    instanceParam.setStartDate(instance.getTime());
//    instanceParam.setEndDate(new Date());
//    instanceParam.setStartSum(9000);
//    instanceParam.setEndSum(20000);
//    IPage<TWiteoffInstance> tWiteoffInstanceIPage = instanceService.QueryTwiteoffInstance(instanceParam);
//    System.out.println(JsonResult.success(new Page(tWiteoffInstanceIPage)));
//  }
  
  @Test
  public void testInsertPassbookWiteoff() {
    List<String> invoiceList = new ArrayList<>();
    invoiceList.add("test");
    passbookMapper.insertPassbookWiteoff("1453178110379180034", invoiceList);
  }
  
  @Test
  public void getSubmitDate() {
    List<String> invoiceList = new ArrayList<>();
    invoiceList.add("template_czpj_330101_482750223312101033");
    List<TPassbook> list = passbookService.getPassbookById(invoiceList);
    System.out.println(UccpUtil.getSubmitDate(list));
  }
}
